package mao.thinkinjava.concurency.myenum;
enum  SecurityCategory {
    STOCK(Security.Stock.class),
    BOND(Security.Bond.class);
    Security[] values;
    private SecurityCategory(Class<? extends Security> clazz){
        values=clazz.getEnumConstants();
    }
    public Security getRandomSelect(){
        return Enums.random(values);
    }
    interface Security {
        enum Stock implements Security {Short,Medium,Long}
        enum Bond implements Security {AA,BB}
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            SecurityCategory c = Enums.random(SecurityCategory.class);
            Security randomSelect = c.getRandomSelect();
            System.out.println(randomSelect);
        }
        //只能这么访问里面的enum类型？？？
        for (int i = 0; i < 10; i++) {
            SecurityCategory c = Enums.random(SecurityCategory.class);
            System.out.println(c.values[1]);
        }
    }
}
